package com.wzdigit.wms.basic.enums.writeback;
/*
 * @Author:yangwenbiao
 * @Date 2020/7/30 5:46 PM
 * @version 1.0
 */


import com.wzdigit.wms.basic.enums.BaseEnum;

public enum BackResultEnum implements BaseEnum {

    /**
     * 检验单状态
     */
    DEFAULT_STATE(0, "初始默认","回传结果"),
    BUSINESS_SUCCESS_STATE(1, "业务成功","回传结果"),
    BUSINESS_FAIL_STATE(2, "业务失败","回传结果"),
    SYSTEM_ERROR_STATE(3, "系统失败","回传结果"),


    REPORT_CHECK_STATE(4, "报检","回传结果"),
    REPORT_CHECK_SUC(5, "报检成功","回传结果"),
    REPORT_CHECK_FAIL(6, "报检失败","回传结果"),
    REPORT_CHECK_ERROR(7, "报检异常","回传结果");


    /**
     * 枚举值
     */
    public int code;

    /**
     * 枚举名称
     */
    public String enumName;

    /**
     * 枚举实体类属性描述
     *
     * @return
     */
    public String description;

    BackResultEnum(int code, String enumName) {
        this.code = code;
        this.enumName = enumName;
    }

    BackResultEnum(int code, String enumName, String description) {
        this.code = code;
        this.enumName = enumName;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getEnumName() {
        return enumName;
    }

    public String getDescription() {
        return description;
    }

    public static BackResultEnum getEnumByCode(int enumCode) {
        BackResultEnum[] values = BackResultEnum.values();
        BackResultEnum repairEnum = null;

        for (BackResultEnum value : values) {
            if (value.getCode() == enumCode) {
                repairEnum = value;
            }
        }
        return repairEnum;
    }

    public static BackResultEnum getEnumByName(String enumName) {
        BackResultEnum[] values = BackResultEnum.values();
        BackResultEnum repairEnum = null;

        for (BackResultEnum value : values) {
            if (value.getEnumName().equals(enumName)) {
                repairEnum = value;
            }
        }
        return repairEnum;
    }
}
